include ../etc/Makefile.conf

TARGS = $(BIN)/lazy-ocaml $(BIN)/fmteraser
LOCAL_SRCS = $(wildcard *.ml *.mli *.mll *.mly)
OCAML_SRCS = $(wildcard ocaml/*.ml ocaml/*.mli ocaml/*.mll ocaml/*.mly)
SRCS = $(LOCAL_SRCS) $(OCAML_SRCS) autoconfig.ml
FLAGS = -I ocaml -no-links -classic-display -cflags -w,Ae,-warn-error,A

all: $(TARGS)

$(BIN)/lazy-ocaml: _build/main.native
	cp $< $@

_build/main.native: $(SRCS)
	@$(OCAMLBUILD) $(FLAGS) main.native

$(BIN)/fmteraser: _build/fmteraser.native
	cp $< $@

_build/fmteraser.native: $(SRCS)
	@$(OCAMLBUILD) $(FLAGS) fmteraser.native

autoconfig.ml: $(ETC)/autoconfig.ml
	cp $< $@

tests:
	@make --no-print-directory -C $(TESTS) tests

clean:
	@$(OCAMLBUILD) $(FLAGS) -clean
	@rm -f *~ $(TARGS) autoconfig.ml

.PHONY: all tests clean
